//
//  ViewController.m
//  Runloop
//
//  Created by 周成龙 on 16/10/12.
//  Copyright © 2016年 ZCL. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

{
    dispatch_source_t timer;
}

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    
    dispatch_queue_t queue = dispatch_get_global_queue(0, 0);
    
    timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
    dispatch_source_set_timer(timer, DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC, 0 * NSEC_PER_SEC);
    dispatch_source_set_event_handler(timer, ^{
        NSLog(@"---");
    });
    dispatch_resume(timer);
    
    
    
    [NSRunLoop currentRunLoop];
    
    
//    NSTimer *time = [NSTimer timerWithTimeInterval:1.0 target:self selector:@selector(show) userInfo:nil repeats:YES];
//    [[NSRunLoop currentRunLoop] addTimer:time forMode:NSRunLoopCommonModes];
}

- (void)show
{
    NSLog(@"---");
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
